<template>
	<div>
		<!-- 头部 -->
		<el-form inline label-width="80px">
			<el-form-item>
				<el-input v-model="parmas.query">
					<el-button
						type="primary"
						slot="append"
						icon="el-icon-search"
					></el-button>
				</el-input>
			</el-form-item>
			<el-form-item>
				<el-button type="primary" @click="$router.push('/main/addgoods')"
					>添加商品</el-button
				>
			</el-form-item>
		</el-form>
		<!-- 面板 -->
		<el-table :data="tableData" style="width: 100%">
			<!-- 序号 -->
			<el-table-column type="index"> </el-table-column>
			<!-- 商品名称 -->
			<el-table-column prop="goods_name" label="商品名称"> </el-table-column>
			<!-- 操作 -->
			<el-table-column label="操作">
				<template v-slot="{ row }">
					<el-button type="danger" @click="deleteItem(row)">删除</el-button>
				</template>
			</el-table-column>
		</el-table>
	</div>
</template>

<script>
import { getGoodsList } from '@/api/goods'
export default {
	data() {
		return {
			tableData: [],
			total: 0,
			parmas: {
				query: '',
				pagenum: 1,
				pagesize: 10,
			},
		}
	},
	methods: {
		deleteItem(row) {
			console.log('删除')
		},
	},
	mounted() {
		getGoodsList(this.parmas).then(({ data }) => {
			var { goods, total } = data.data
			this.tableData = goods
			this.total = total
		})
	},
}
</script>

<style>
</style>